home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / listbox / filler / dbcombot.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-11-22  |  3.0 KB  |  102 lines

  1. VERSION 4.00
  2. Begin VB.Form DBComboTest 
  3.    Caption         =   "DBCombo Replacment"
  4.    ClientHeight    =   4140
  5.    ClientLeft      =   645
  6.    ClientTop       =   1545
  7.    ClientWidth     =   5910
  8.    Height          =   4545
  9.    Left            =   585
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4140
  12.    ScaleWidth      =   5910
  13.    Top             =   1200
  14.    Width           =   6030
  15.    Begin VB.CommandButton Command1 
  16.       Caption         =   "Close"
  17.       Height          =   735
  18.       Left            =   1800
  19.       TabIndex        =   3
  20.       Top             =   3120
  21.       Width           =   2295
  22.    End
  23.    Begin VB.ComboBox Combo1 
  24.       Height          =   315
  25.       Index           =   1
  26.       Left            =   360
  27.       TabIndex        =   2
  28.       Top             =   1320
  29.       Width           =   5295
  30.    End
  31.    Begin VB.ListBox List1 
  32.       Height          =   1230
  33.       Left            =   360
  34.       TabIndex        =   1
  35.       Top             =   1680
  36.       Width           =   5295
  37.    End
  38.    Begin VB.ComboBox Combo1 
  39.       Height          =   315
  40.       Index           =   0
  41.       Left            =   360
  42.       TabIndex        =   0
  43.       Top             =   480
  44.       Width           =   5295
  45.    End
  46.    Begin VB.Label Label2 
  47.       Caption         =   "Titles"
  48.       Height          =   255
  49.       Left            =   360
  50.       TabIndex        =   5
  51.       Top             =   1080
  52.       Width           =   615
  53.    End
  54.    Begin VB.Label Label1 
  55.       Caption         =   "Publishers"
  56.       Height          =   255
  57.       Left            =   360
  58.       TabIndex        =   4
  59.       Top             =   240
  60.       Width           =   1335
  61.    End
  62. Attribute VB_Name = "DBComboTest"
  63. Attribute VB_Creatable = False
  64. Attribute VB_Exposed = False
  65. Option Explicit
  66. Private Sub Combo1_Change(Index As Integer)
  67. End Sub
  68. Private Sub Command1_Click()
  69. End Sub
  70. Private Sub Form_Load()
  71. 'See Declaration section of the Class module for comments.
  72. Dim DB As Database
  73. Dim RS As Recordset
  74. Dim DbPath As String, i As Integer
  75. Dim CnrtFill As ControlFill
  76. Set CnrtFill = New ControlFill
  77. DbPath = "G:\VB32\BIBLIO.MDB"
  78. Set DB = OpenDatabase(DbPath)
  79. For i = 0 To 2
  80.     Select Case i
  81.         Case 0
  82.             Set RS = DB.OpenRecordset("Publishers", dbOpenSnapshot)
  83.             CnrtFill.SourceField = "Company Name"
  84.             CnrtFill.SourceControl = Combo1(i)
  85.         Case 1
  86.             Set RS = DB.OpenRecordset("Titles", dbOpenSnapshot)
  87.             CnrtFill.SourceField = "Title"
  88.             CnrtFill.SourceControl = Combo1(i)
  89.         Case 2
  90.             ' You Could set the listbox to a different recordset, but for this demo
  91.             ' I'm filling with the last recordset.
  92.             CnrtFill.SourceControl = List1
  93.             Set RS = DB.OpenRecordset("Titles", dbOpenSnapshot)
  94.             CnrtFill.SourceField = "Title"
  95.     End Select
  96. CnrtFill.SourceRS = RS
  97. If CnrtFill.FillControl = False Then
  98.     MsgBox "Invalid Control Reference"
  99. End If
  100. Next i
  101. End Sub
  102.